
<%@page import="evol.Predmet"%>
<%@page import="evol.Rezultat"%>
<%@ page import="evol.Odgovor"%>
<!doctype html>
<html>
<head>
<meta name="layout" content="main">
<g:set var="entityName"
	value="${message(code: 'odgovor.label', default: 'Odgovor')}" />
<title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
	<a href="#list-odgovor" class="skip" tabindex="-1"><g:message
			code="default.link.skip.label" default="Skip to content&hellip;" /></a>
	<div class="nav" role="navigation">
		<ul>
			<li><a class="home" href="${createLink(uri: '/')}"><g:message
						code="default.home.label" /></a></li>
			<li><g:link class="create" action="create">
					<g:message code="default.new.label" args="[entityName]" />
				</g:link></li>
		</ul>
	</div>
	<div id="list-odgovor" class="content scaffold-list" role="main">

		<h1>
			<g:message code="default.list.label" args="[entityName]" />

		</h1>


		<div id="div-pretraga"
			style="background-color: #efefef; height: 80px;">
			<form action="list">
				<g:select name="predmet" from="${ Predmet.list()}" value="${naziv}"
					style="margin-left: 3%;margin-top:5px"
					noSelection="['':'-izaberite predmet-']" />
				<select name="predsmer" style="margin-top: 5px;">
					<option value="od">Predmet - Od</option>
					<option value="do">Predmet - Do</option>
				</select> <input type="submit" value="Trazi" />
				<%--
				 <input type="checkbox" onclick="if(this.checked==1) document.getElementById('sakriven').hidden=false;else document.getElementById('sakriven').hidden=true">
				
				
				
				--%>
				<div id="sakriven" hidden="true">

					<select name="dodatni-param"
						style="margin-top: 5px; margin-left: 3%"
						onclick="document.getElementById('t-param').hidden=false;">
						<option value="korisnik">Korisnik</option>
						<option value="datum">Datum</option>
						<option value="indeks">Indeks</option>
					</select> <input id="t-param" hidden="true" type="text"
						style="border-style: dotted; margin-top: 5px; margin-left: 3%"
						name="kriterijum">
					<%--<input type="button" value="Trazi" class="buttons;button" > --%>

				</div>

			</form>
			<%--
				 document.getElementById('sakriven').hidden=false;
				 document.getElementById('div-pretraga').style.height=80px;--%>

		</div>





		<g:if test="${flash.message}">
			<div class="message" role="status">
				${flash.message}
			</div>
		</g:if>
		<table>
			<thead>
				<tr>

					<g:sortableColumn property="datum"
						title="${message(code: 'odgovor.datum.label', default: 'Datum')}" />


					<g:sortableColumn property="idDo" title="Id Do" />
					<g:sortableColumn property="idOd" title="Id Od" />


					<g:sortableColumn property="indeks"
						title="${message(code: 'odgovor.indeks.label', default: 'Indeks')}" />

					<g:sortableColumn property="korisnik"
						title="${message(code: 'odgovor.korisnik.label', default: 'Korisnik')}" />
					<th><g:if test="${filter == 'da'}">Istr</g:if></th>
				</tr>
			</thead>
			<tbody>
				<g:each in="${odgovorInstanceList}" status="i" var="odgovorInstance">
					<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">

						<td><g:link action="show" id="${odgovorInstance.id}">
								<g:formatDate format="dd-MM-yyyy"> ${fieldValue(bean: odgovorInstance, field: "datum")}</g:formatDate>
							</g:link></td>

						<td>
							${fieldValue(bean: odgovorInstance.getAt("idDo"), field: "naziv")}
						</td>

						<td>
							${fieldValue(bean: odgovorInstance.getAt("idOd"), field: "naziv")}
						</td>

						<td>
							${fieldValue(bean: odgovorInstance, field: "indeks")}
						</td>

						<td>
						<g:if test="${fieldValue(bean: odgovorInstance, field: "korisnik").isLong()}">
							${fieldValue(bean: odgovorInstance, field: "korisnik").substring(15)}	
							</g:if>
						 <g:else>${fieldValue(bean: odgovorInstance, field: "korisnik")}</g:else>
						</td>
						<td><g:if test="${filter == 'da'}">
								<input name="a" type="checkbox" />
							</g:if></td>
					</tr>
				</g:each>
			</tbody>
		</table>
		<div class="pagination">
			<g:paginate total="${odgovorInstanceTotal}" />
		</div>
	</div>
</body>
</html>
